'''a=10;
b=20;
c=30;
if a>b: print("a>b");
else:print("b>a");
if b>c: print("b>c");
else:print("c>b");
if c>a: print("c>a");
else:print("a>c");'''


#猜数字
'''import random

# 初始化一个随机数字
number = random.randint(1, 100)

# 玩家最多有5次猜数字的机会
for i in range(5):
    guess = int(input("请输入一个数字（1-100）: "))

    if guess == number:
        print("恭喜你，猜对了！")
        break  # 猜对了就跳出循环
    elif guess < number:
        print("你猜的数字小了！")
    else:
        print("你猜的数字大了！")
else:
    print("抱歉，次数用完，正确答案是：", number)'''

    #菱形
'''num = 3

# 上半部分
for i in range(num):
    # 循环空格
    for j in range(num - i - 1):
        print(" ", end="")
    # 循环星号
    for k in range(2 * i + 1):
        print("*", end="")
    print()  # 换行

# 下半部分
for i in range(num - 1):
    # 循环空格
    for j in range(i + 1):
        print(" ", end="")
    # 循环星号
    for k in range(2 * (num - i - 1) - 1):
        print("*", end="")
    print()  # 换行
    '''
#水仙花数
'''def is_armstrong(num):
     digits = len(str(num))
    sum = 0
    temp = num
    while temp > 0:
        digit = temp % 10
        sum += digit ** digits
        temp //= 10
    return num == sum

for num in range(100, 1000):
    if is_armstrong(num):
        print(num)
'''
#打印99乘法表
'''for i in range(1,10):
    for j in range(1,i+1):
        print("%d*%d=%d"%(i,j,i*j),end="\t")
    print()
    '''
#打印完数
'''def is_hanshu(num):
    sum = 0
    for i in range(1,num):
        if num % i == 0:
            sum += i
    return sum == num
for i in range(1,10001):
    if is_hanshu(i):
        print(i)
        break
       '''
#打印质数
'''def is_prime(num):
    if num < 2:
        return False
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            return False
    return True
for i in range(1, 1000):
    if is_prime(i):
        print(i)
'''
#打印斐波那契数列
def fibonacci(n):
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    elif n == 2:
        return [0, 1]
    else:
        fib_sequence = [0, 1]
        while len(fib_sequence) < n:
            fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
        return fib_sequence

# 打印前 10 个斐波那契数
fib_sequence = fibonacci(10)
for num in fib_sequence:
    print(num)







